package com.zego.wawaji.ui.dialog;

import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.zego.wawaji.R;
import com.zego.wawaji.ui.dialog.popup.BottomPopup;

/**
 * 签到弹框
 * Created by Su on 2017/11/26.
 */
public class SignDialog extends BottomPopup {
    private int awardNum;   // 签到奖励
    private int dayNum;     // 累计签到天数

    public SignDialog(FragmentActivity activity) {
        super(activity);
        setCancelableOutTouch(false);
    }

    @Override
    protected View makeContentView() {
        View inflate = LayoutInflater.from(activity).inflate(R.layout.sign_in_dialog, null);
        TextView tv_award = (TextView) inflate.findViewById(R.id.tv_award);
        TextView tv_dayNum = (TextView) inflate.findViewById(R.id.tv_day_num);
        inflate.findViewById(R.id.rl_sign).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

        tv_award.setText("+" + awardNum);
        tv_dayNum.setText(getActivity().getString(R.string.sign_day_num, dayNum));

        return inflate;
    }

    /**
     * 设置签到奖励
     */
    public void setAwardNum(int awardNum) {
        this.awardNum = awardNum;
    }

    /**
     * 设置累计签到天数
     */
    public void setDayNum(int dayNum) {
        this.dayNum = dayNum;
    }
}
